﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IBLL;
using BLLFactory;

namespace Face.Web.login_and_signup
{
    public partial class signup: System.Web.UI.Page
    {

        UserinfoIBLL userinfoIBLL = BLLFactory.DataAccess.getUserinfoIBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void registerButton_Click(object sender, EventArgs e)
        {
            string username = Iusername.Value;
            string password = Ipassword.Value;
            string email = Iemail.Value;
            string code = txtCheckCode.Text;
            string realcode = (string)Session["randString"];
            //realcode为真正验证码的值
            bool male = optionsRadios1.Checked;
            bool female = optionsRadios2.Checked;
            string sex = "male";
            if (female)
            {
                sex = "female";
            }

            string select = selection.Value;
            string answer = question_answer.Value;

            //注意，前台没有生日选项
            if (realcode == code)
            {
                userinfoIBLL.userRegister(username, password, email, sex, System.DateTime.Now, select, answer);
                Response.Redirect("/login_and_signup/emailValidate.aspx");
            }
        }

    }
}